/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.sentry.protocol;

import io.sentry.IUnknownPropertiesConsumer;

import java.util.Map;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * Holds information about the system SDK.
 *
 * <p>This is relevant for iOS and other platforms that have a system SDK. Not to be confused with
 * the client SDK.
 *
 * @since 2021-06-02
 */
public final class SdkInfo implements IUnknownPropertiesConsumer {
    /**
     * The internal name of the SDK.
     */
    private @Nullable String sdkName;
    /**
     * The major version of the SDK as integer or 0.
     */
    private @Nullable Integer versionMajor;
    /**
     * The minor version of the SDK as integer or 0.
     */
    private @Nullable Integer versionMinor;
    /**
     * The patch version of the SDK as integer or 0.
     */
    private @Nullable Integer versionPatchlevel;

    @SuppressWarnings("unused")
    private @Nullable Map<String, Object> unknown;

    public @Nullable String getSdkName() {
        return sdkName;
    }

    public void setSdkName(final @Nullable String sdkName) {
        this.sdkName = sdkName;
    }

    public @Nullable Integer getVersionMajor() {
        return versionMajor;
    }

    public void setVersionMajor(final @Nullable Integer versionMajor) {
        this.versionMajor = versionMajor;
    }

    public @Nullable Integer getVersionMinor() {
        return versionMinor;
    }

    public void setVersionMinor(final @Nullable Integer versionMinor) {
        this.versionMinor = versionMinor;
    }

    public @Nullable Integer getVersionPatchlevel() {
        return versionPatchlevel;
    }

    public void setVersionPatchlevel(final @Nullable Integer versionPatchlevel) {
        this.versionPatchlevel = versionPatchlevel;
    }

    @ApiStatus.Internal
    @Override
    public void acceptUnknownProperties(final @NotNull Map<String, Object> unknowns) {
        this.unknown = unknowns;
    }
}
